<?php

/*
 * Fresns Control Panel (Standalone)
 * Copyright (C) 2021-Present 刘鑫
 * Released under the MIT License.
 */

namespace App\Plugins\FcpApi\TweetFileAppends;

use App\Base\Controllers\BaseAdminController;
use App\Plugins\FcpApi\Base\TweetBaseController;

class FsControllerAdmin extends TweetBaseController
{
    public function __construct()
    {
        parent::__construct();
        $this->service = new FsService();
    }

    // 验证规则
    public function rules($ruleType)
    {
        $rule = [];

        $config = new FsConfig($this->service->getTable());

        switch ($ruleType) {
            case FsConfig::RULE_STORE:
                $rule = $config->storeRule();
                break;

            case FsConfig::RULE_UPDATE:
                $rule = $config->updateRule();
                break;

            case FsConfig::RULE_DESTROY:
                $rule = $config->destroyRule();
                break;

            case FsConfig::RULE_DETAIL:
                $rule = $config->detailRule();
                break;
        }

        return $rule;
    }
}
